
BAREBOX_ULOADER_SITE = $(call qstrip,$(BR2_TARGET_BAREBOX_ULOADER_URL))
BAREBOX_ULOADER_INSTALL_IMAGES = YES
BAREBOX_ULOADER_BOARD_DEFCONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_ULOADER_BOARD_DEFCONFIG))

ifeq ($(KERNEL_ARCH),i386)
BAREBOX_ULOADER_ARCH=x86
else ifeq ($(KERNEL_ARCH),powerpc)
BAREBOX_ULOADER_ARCH=ppc
else
BAREBOX_ULOADER_ARCH=$(KERNEL_ARCH)
endif

BAREBOX_ULOADER_MAKE_FLAGS = ARCH=$(BAREBOX_ULOADER_ARCH) CROSS_COMPILE="$(CCACHE) $(TARGET_CROSS)"

define BAREBOX_ULOADER_CONFIGURE_CMDS
	$(MAKE) $(BAREBOX_ULOADER_MAKE_FLAGS) -C $(@D) $(BAREBOX_ULOADER_BOARD_DEFCONFIG)_defconfig
endef

define BAREBOX_ULOADER_BUILD_CMDS
	$(BAREBOX_ULOADER_BUILD_BAREBOXENV_CMDS)
	$(MAKE) $(BAREBOX_ULOADER_MAKE_FLAGS) -C $(@D)
endef

define BAREBOX_ULOADER_INSTALL_IMAGES_CMDS
	cp $(@D)/uloader.bin $(BINARIES_DIR)
endef

$(eval $(call GENTARGETS))
